package Test;

import java.util.HashSet;
import java.util.Scanner;


/**
 * @BelongsProject: LeetCode
 * @BelongsPackage: Test
 * @Author: song
 * @CreateTime: 2022-12-14  14:54
 * @Description: TODO
 * @Version: 1.0
 */

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        in.close();
        System.out.println(lengthOfLongestSubstring(str));
    }
    public static int lengthOfLongestSubstring(String str){
        if (str.length() == 0)
            return 0;
        int res = 1;
        HashSet<Character> set = new HashSet<>();
        for (int i = 0; i < str.length() - 1; i++) {
            set.add(str.charAt(i));
            for (int j = i + 1; j < str.length(); j++) {
                char c = str.charAt(j);
                if(set.contains(c))
                    break;
                set.add(c);
            }
            if (res < set.size()){
                res = set.size();
            }
            set.clear();
        }
        return res;
    }
}
